//**************************************************************//
//  Effect File exported by RenderMonkey 1.6
//
//  - Although many improvements were made to RenderMonkey FX  
//    file export, there are still situations that may cause   
//    compilation problems once the file is exported, such as  
//    occasional naming conflicts for methods, since FX format 
//    does not support any notions of name spaces. You need to 
//    try to create workspaces in such a way as to minimize    
//    potential naming conflicts on export.                    
//    
//  - Note that to minimize resulting name collisions in the FX 
//    file, RenderMonkey will mangle names for passes, shaders  
//    and function names as necessary to reduce name conflicts. 
//**************************************************************//

//--------------------------------------------------------------//
// Position
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// Pass 0
//--------------------------------------------------------------//
string Position_Pass_0_Model : ModelData = "..\\..\\..\\Programme\\RenderMonkey\\Examples\\Media\\Models\\Teapot.3ds";

float4x4 matViewProjection;
float4x4 World;
float4x4 View;

struct VS_INPUT 
{
   float4 Position : POSITION0;
};

struct VS_OUTPUT 
{
   float4 Position : POSITION0;
   float depth : TEXCOORD0;
};

VS_OUTPUT Position_Pass_0_Vertex_Shader_vs_main( VS_INPUT Input )
{
   VS_OUTPUT Output;
   
   float4 worldPosition = mul(Input.Position, World);
   float4 viewPosition = mul(worldPosition, View);
   Output.Position = mul( viewPosition, matViewProjection );
   Output.depth = Output.Position.z;
   
   return(Output);
   
}




float fFarClipPlane : FarClipPlane;
float fNearClipPlane : NearClipPlane;

struct PS_INPUT 
{
   float4 Position : POSITION0;
   float depth : TEXCOORD0;
};

float4 Position_Pass_0_Pixel_Shader_ps_main(PS_INPUT Input) : COLOR0
{   
   float x = 1.0 - (Input.depth / (fFarClipPlane - fNearClipPlane));
   return float4(x,x,x,1);
}
//--------------------------------------------------------------//
// Technique Section for Position
//--------------------------------------------------------------//
technique Position
{
   pass Pass_0
   {
      VertexShader = compile vs_2_0 Position_Pass_0_Vertex_Shader_vs_main();
      PixelShader = compile ps_2_0 Position_Pass_0_Pixel_Shader_ps_main();
   }

}

